package com.aididi.run;

import com.aididi.interfaces.BookRepository;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @Auther: zx.xu
 * @Description:    启动时执行
 */
@Log4j2
@Component
public class AppRunner implements CommandLineRunner {

    private BookRepository bookRepository;

    public AppRunner(BookRepository bookRepository){
        this.bookRepository = bookRepository;
    }

    @Override
    public void run(String... args) throws Exception {
        log.info("...starting");
        log.info("1--"+bookRepository.getByIsbn("--1--"));
        log.info("2--"+bookRepository.getByIsbn("--2--"));
        log.info("3--"+bookRepository.getByIsbn("--3--"));
        log.info("1--"+bookRepository.getByIsbn("--1--"));
        log.info("4--"+bookRepository.getByIsbn("--4--"));
        log.info("2--"+bookRepository.getByIsbn("--2--"));
    }
}
